Split an array in javascript based on the key for dataPoints